/**
 * 				MochitoHost.java
 *				------------
 *		
 *   Author:	bin04017@gmail.com
 *	 Created:	22.12.2006
 *	 Project:	Mochito-TransferFramework
 *	 Package:	mochitoTranferFactory.mochitoHost
 *	 Usage:		Mochito host informations
 * *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 */
package mochitoTransferFactory.mochitoHost;

import java.net.InetAddress;
import java.net.UnknownHostException;

import mochitoTransferFactory.MochitoException;

/**
 * @author bin04017
 * 
 */
public class MochitoHost {

	private InetAddress ip;

	public MochitoHost(String host) throws MochitoException{
		init(host);
	}
	public MochitoHost(InetAddress localHost) throws MochitoException{
		this.ip = localHost;
	}
	/**
	 * set ip
	 * @param host
	 * @throws MochitoException 
	 * @throws UnknownHostException
	 */
	private void init(String host) throws MochitoException {
			try {
				ip = InetAddress.getByName(host);
			} catch (UnknownHostException e) {
				throw new MochitoException(e);
			}
	}

	/**
	 * @return the ip
	 */
	public InetAddress getIp() {
		return ip;
	}
	public String getHostAsString() {
		return ip.getHostName();
	}
}
